<?php
	$tool_buttons = array
	(
		'add_button' => array
		(
			'image'=>'btnNew.gif', 
			'text'=>LANG_ADD, 
			'url'=>'',
			'attributes'=>'onClick="addTranslationRow();"'
		)
	);
	$this->helpers->htmlx->MenuText(LANG_LANGUAGES.': '.LANG_EDIT, "edit.gif");	
	$this->helpers->toolbars->Toolbar($tool_buttons);
?>
<form action="/spanel/languages/edit/<?php echo $this->data[lang]; ?>" method="post" name="trans">
<span class="success"><?php echo $this->data[out]; ?></span>	
<table class="translations">
	<tr>
		<td align="right" width="1"><input name="submitTrans" type="submit" value="submit" class='submit'></td>
		<td align="left"><input name="reset" type="reset" value="reset" class='submit'></td>
	</tr>
</table>
<table class="translations">
	<tr style="display:none;" id="addTrans">
		<td>
			<input id = 'transLabel' name="" type="text" value="" style='width:95%;' class="text">
		</td>
		<td width="">
			<input id = 'transValue' name="" type="text" value="" style='width:95%;' class="text" onchange="this.name=document.getElementById('transLabel').value">
			<img style='cursor: pointer;' id="img<?php echo $this->data[tr][$i][0]; ?>" src="<?php echo IMAGES ?>btnDelete.gif" onClick="document.getElementById('addTrans').style.display='none'" />
		</td>
	</tr>
<?php
	for ($i=1; $i<$this->data[trans_num]; $i++)
	if ($this->data[tr][$i][0]."" != "")
	{
?>
	<tr>
		<td width="40%"><?php echo $this->data[tr][$i][0]; ?></td>
		<td><nobr>
			<input id="<?php echo $this->data[tr][$i][0]; ?>" name="<?php echo $this->data[tr][$i][0]; ?>" type="text" value="<?php echo $this->data[tr][$i][1]; ?>" style='width:95%;' class="text">
			<img style='cursor: pointer;' id="img<?php echo $this->data[tr][$i][0]; ?>" src="<?php echo IMAGES ?>btnDelete.gif" onClick="deleteTranslation('<?php echo $this->data[tr][$i][0]; ?>');" /></nobr>
		</td>
	</tr>
<?php
	}
?>
</table>
<table class="translations">
	<tr>
		<td align="right" width="1"><input name="submitTrans" type="submit" value="submit" class='submit'></td>
		<td align="left"><input name="reset" type="reset" value="reset" class='submit'></td>
	</tr>
</table>
</form>
<script>
	function addTranslationRow()
	{
		tag = document.getElementById('addTrans');
		tag.style.display = '';
	}
	
	function deleteTranslation(id)
	{
		elem = document.getElementById(id);
		img = document.getElementById('img'+id);
		if (elem.disabled) 
		{
			elem.removeAttribute('disabled');
			img.src = '<?php echo IMAGES ?>'+'btnDelete.gif';
		}
		else 
		{
			elem.disabled='disabled';
			img.src = '<?php echo IMAGES ?>'+'btnUndelete.gif';
		}
	}
</script>